<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>setlocale</title>
  <link href="../cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="../index.html">cppreference.com</a> &gt; <a href=
    "index.html">Standard C Date &amp; Time</a> &gt; <a href=
    "setlocale.html">setlocale</a>
  </div>

  <div class="name-format">
    setlocale
  </div>

  <div class="syntax-name-format">
    Syntax:
  </div>
  <pre class="syntax-box">
  #include &lt;locale.h&gt;
  char *setlocale( int category, const char * locale );
</pre>

  <p>The setlocale() function is used to set and retrieve the current
  locale. If <em>locale</em> is <strong>NULL</strong>, the current
  locale is returned. Otherwise, <em>locale</em> is used to set the
  locale for the given <em>category</em>.</p>

  <p><em>category</em> can have the following values:</p>

  <table class="code-table">
    <tr>
      <th class="code-table-th">Value</th>

      <th class="code-table-th">Description</th>
    </tr>

    <tr>
      <td class="code-table-td">LC_ALL</td>

      <td class="code-table-td">All of the locale</td>
    </tr>

    <tr>
      <td class="code-table-td">LC_TIME</td>

      <td class="code-table-td">Date and time formatting</td>
    </tr>

    <tr>
      <td class="code-table-td">LC_NUMERIC</td>

      <td class="code-table-td">Number formatting</td>
    </tr>

    <tr>
      <td class="code-table-td">LC_COLLATE</td>

      <td class="code-table-td">String collation and regular expression
      matching</td>
    </tr>

    <tr>
      <td class="code-table-td">LC_C<a href=
      "../containers.html">TYPE</a></td>

      <td class="code-table-td">Regular expression matching,
      conversion, case-sensitive comparison, wide character functions,
      and character classification.</td>
    </tr>

    <tr>
      <td class="code-table-td">LC_MONETARY</td>

      <td class="code-table-td">For monetary formatting</td>
    </tr>

    <tr>
      <td class="code-table-td">LC_MESSAGES</td>

      <td class="code-table-td">For natural language messages</td>
    </tr>
  </table>

  <div class="related-name-format">
    Related topics:
  </div>

  <div class="related-content">
    (Standard C String and Character) <a href=
    "../stdstring/strcoll.html">strcoll</a>
  </div>
  </div>
  </td>
  


  </tr>
  </table>
</body></html>
